Sugar
Sugar gives you a lot of cool stuff to enhance your codebase.
It basically does nothing by default but let you grab what you want from it. It can be the colors management feature, as well as the spaces management, helper classes, etc...
We like to think about this toolkit as
A little (but powerful) sugar in your codebase
Table of content
- Goals
- Install
- Quick start
- Sass features
- JS features
- What sugar does not
- Other tools integration
- Some components demos
- Contribute
- Browsers support
- License
- Who are Coffeekraken
Goals
The primary goal of this toolkit is to cover these needs:
- Give you a way to organize your codebase (colors, fonts, etc...)
- Sugar does not tells you how your folders need to be layed out
- Help you to stay organized inside your code
- Help a lot when you need to work in team
- Give you access to a large number of useful mixins like:
- Give you access to some cool effects that you can tweak like:
- Provide some useful daily use javascript functions like:
- Provide some powerful javascript classes like:
- SWebComponent : Base class to create webcomponent based on react methods naming (componentWillMount, componentMount, etc...)
- SBinder : Allows you to bind object properties to another object
- SWatcher : Allows you to monitor object properties
- STimer : Nice little class to handle timers (start, stop, pause, onTick, etc...)
- And many more...
- Plenty web components based on the
SWebComponent
class
- These web components are separated into outside repositories
- Official sugar web components are published on the Coffeekraken github organisation
- Well tested components
- Open source so don't be afraid to contribute!
Install
npm install coffeekraken-sugar --save
Release the kraken !!! 🦑
Quick start
Here's how to get started quickly:
SASS (scss)
@import 'node_modules/coffeekraken-sugar/index';
@include s-setup((
// configuration here...
));
@include s-init();
@include s-classes();
JS
In javascript, you just need to import what you want from the toolkit like so:
import STimer from 'coffeekraken-sugar/js/classes/STimer';
Sass features
Here's a list of features that the toolkit will offer you. Don't worry, it seems like a lot, but you don't need to use all of them to start. Just pick what you need and let the rest aside...
- Colors : Manage, organize and use colors easily
- Named colors
- Easy modifiers
- Helper classes (optional)
- And more...
- Fonts : Keep your fonts really organized
- Names fonts
- Helper mixins
- Helper classes (optional)
- And more...
- Typography : Full stack typography management
- Helper mixins
- Helper classes (optional) (lowercase, uppercase, aligns, etc...)
- And more...
- Sizes : Manage sizes ratios to keep consistent margins, etc...
- Named sizes (smaller, small, default, etc...)
- Fully customizable
- Ratio based
- And more...
- Spaces : Full stack spaces management
- Named spaces (share sizes names)
- Helper classes (optional)
.m-b-small
: Margin bottom small.m-t-big
: Margin top big.p-l
: Padding left (default)- Etc...
- Helper mixins
- And more...
- Look and feel : Handle how your components (atoms) looks across your site
- em unit based
- Helper mixins
- Ensure a consistent feel across your website
- And more...
- Filters : Manage and keep your filters organized
- Named filters
- Helper mixins
- Helper classes (optional)
- And more...
- Transitions : Manage and keep your transitions organized
- Named transitions
- Helper mixins
- Helper classes (optional)
- And more...
- And many more cool stuffs like:
- A bunch of cool mixins to discover
- Utils functions like :
- s-convert : Convert from a unit to another
- s-is : Easily advanced variables type checking
- And more...
- We let you discover the rest by yourself...
JS features
Sugar provide a lot of cool functions and classes that you can use inside your project.
The main goal sugar try to achieve is to give you some cool tools that you can or not use. It's your choice and sugar will never force you in any way.
All the javascript capabilities of sugar are well structured and splited inside the repository so you will be able to grab only what you want from it. Here's some examples of functions and classes you might load in your project:
import whenAttribute from 'coffeekraken-sugar/js/dom/whenAttribute'
import closest from 'coffeekraken-sugar/js/dom/closest'
import whenInViewport from 'coffeekraken-sugar/js/dom/whenInViewport'
import whenAttribute from 'coffeekraken-sugar/js/dom/whenAttribute'
import closestNotVisible from 'coffeekraken-sugar/js/dom/closestNotVisible'
import SColor from 'coffeekraken-sugar/js/classes/SColor'
import STimer from 'coffeekraken-sugar/js/classes/STimer'
import SWebComponent from 'coffeekraken-sugar/js/core/SWebComponent'
- Classes : Set of useful classes like:
- STimer : Handle times with nice control like start, stop, pause, etc...
- SColor : Manipulate colors and access your sass registered colors
- And more...
- DOM Helpers : Set of useful DOM related functions like:
- closest : Equivalent of the jQuery closest functions
- whenInViewport : Let you know when an element enter the viewport the first time
- whenAttribute : Let you know when an element has a specifiy attribute (or that an attribute is a string, etc...)
- scrollTo : Animate the scroll to a certain element in the page
- And more
- Easings : Set of easings functions
- Filters : Cool js filters like:
- Features : Additional auto-applied DOM behaviors
- Utils : Utils function for strings, colors, objects, etc... like:
- Web Components : Powerful web components library like:
Other tools integration
Sugar is also focused on being a good friend with other tools. Here's some tools that you can use with:
- Carpenter : Styleguide and documentation aggregator interface for your projects
- Generate styleguide from your css codebase
- Aggregate documentations from used modules inside 1 interface
- Freaking cool to work in team
- And more...
- Docblock parser : Parse docblocks to JSON
- Sugar is all documented with clean docblocks inside source files
- Webpack : Build final package JS file from ES6 modules codebase
- Let us know if you have other cool ideas around some Sugar integrations...
What Sugar does not
Sugar has some goals it try to achieve, and have also some things that it does intentionally not like:
- Vendor prefixing your CSS
- Implement polyfills like webcomponent.js, etc...
- You will need to integrate them yourself when you need to...
- Force you to use his features
- Grab what you want from the toolkit, keep the rest aside...
Contribute
Sugar is an open source project and will ever be! You are more that welcomed to contribute to his development and make it more awesome every day.
To do so, you have several possibilities:
- Share the love ❤️
- Declare issues
- Fix issues
- Add features
- Build web component
Browsers support
IE / Edge | Firefox | Chrome | Safari |
---|
IE11+ | last 2 versions | last 2 versions | last 2 versions |
As browsers are automatically updated, we will keep as reference the last two versions of each but this component can work on older ones as well.
License
The code is available under the MIT license. This mean that you can use, modify, or do whatever you want with it. This mean also that it is shipped to you for free, so don't be a hater and if you find some issues, etc... feel free to contribute instead of sharing your frustrations on social networks like an asshole...
Who are Coffeekraken
We try to be some cool guys that build some cool tools to make our (and yours hopefully) every day life better.